package cn.iocoder.yudao.module.handguard.controller.app.publicitynotice;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.handguard.controller.admin.publicitynotice.vo.PublicityNoticeRespVO;
import cn.iocoder.yudao.module.handguard.controller.admin.publicitynotice.vo.PublicityNoticeUpdateReqVO;
import cn.iocoder.yudao.module.handguard.controller.app.publicitynotice.vo.NoticeReqParam;
import cn.iocoder.yudao.module.handguard.convert.publicitynotice.PublicityNoticeConvert;
import cn.iocoder.yudao.module.handguard.dal.dataobject.publicitynotice.PublicityNoticeDO;
import cn.iocoder.yudao.module.handguard.service.publicitynotice.PublicityNoticeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "小程序 - 弹窗公示")
@RestController
@RequestMapping("/general/notice")
@Validated
public class PublicityNoticeAppController {

    @Resource
    private PublicityNoticeService publicityNoticeService;

    @GetMapping("/get")
    @Operation(summary = "弹窗公告")
    public CommonResult<PublicityNoticeRespVO> getPublicityNoticeById(NoticeReqParam param) {
        PublicityNoticeDO noticeDO = publicityNoticeService.getCommonListByIndex(param.getIndex());
        return success(PublicityNoticeConvert.INSTANCE.convert(noticeDO));
    }


}
